<template>
	<div id='app'>
		<div id="offen_user">

			<ul class="cont">
				<li class="box" v-for="c in actives">
					<div class="user_info">
						<a href="#">
							<p><label>{{c.urname}}</label><span>{{c.urphone}}</span></p>
							<p>{{c.address}}</p>
						</a>
					</div>
					<div class="button">
						<a class="red_hollow" @click="itemClicked1(c)">选择</a>
						<div class="clear"></div>
					</div>
				</li>

			</ul>
			<div class="tc_nav">
				<a class="color_red" @click="itemClicked(actives)">增加新地址</a>
			</div>
		</div>
	</div>
</template>

<script>
	import config from '@/config'
	export default {
		data() {
			return {
				usr: '',
				actives: [],
				vid: '',
				vvid: ''
			}
		},
		onLoad(option) {
			if (option.id) {
				this.vid = option.id;
			}
			if (option.id2) {
				this.vvid = option.id2;
			}
			var that = this;
			uni.request({
				url: `${config.baseUrl}/comment/list1?token=` + uni.getStorageSync('token'),
				method: 'GET',
				success(r) {
					if (r.data.succ) {
							that.actives = r.data.data;
					} else {
					
					}
				},
					complete(res){
						if(res.data && res.data.msg){
							uni.showToast({
								icon:'none',
								title:res.data.msg
							})
						}
					},
			});
		},
		methods: {
			itemClicked: function(item) {
				uni.navigateTo({
					url: 'address?id=' + this.vid
				})
			},
			itemClicked1: function(item) {
				uni.navigateTo({
					url: 'sure_order?id=' + this.vid + '&&id2=' + item.id
				})
			},
			itemClicked2: function(item) {
				uni.navigateTo({
					url: 'sure_order?id=' + this.vid + '&&id2=' + this.vvid
				})
			}
		}
	}
</script>

<style>
</style>
